def dem(n,k):
    result=[]
    path=[]
    def backtracking(n,k,startIndex):
        if len(path)==k:
            result.append(path[:])
            # print(result)
            return ;
        for i in range(startIndex,n+1):
            path.append(i)
            backtracking(n,k,i+1)
            path.pop()
    backtracking(n,k,1)
    return result

n,r=map(int,input().split())
lt=dem(n,r)
for i in lt:
    for j in i:
        print('%3d'%j,end='')
    print()